timber 0.0.1

Simple configurable logging
Documentation

Timber is simple logger facility. It provides means to write logs to given file in concurrent applications.

timber! macro takes as argument level number and writes log only if it is greater than zero. If user defines log levels as constants compiler will be able to ignore strings passed to unused logs and make application smaller. This way user can keep set of debugging logs, but compile them out for release.

By default timber writes logs to stdout. To write to a file one have to pass file path with timber::init(path).

Example wrapper for timber could look like:

#[macro_use(timber)]
use timber;

#[cfg(debug)]
pub mod level {
    pub const ERR: i32 = 1;
    pub const DEB: i32 = 2;
    pub const INF: i32 = 7;
}

#[cfg(not(debug))]
pub mod level {
    pub const ERR: i32 = 1;
    pub const DEB: i32 = 0;
    pub const INF: i32 = 3;
}

macro_rules! log_err{($($arg:tt)*) => {timber!($crate::level::ERR, "ERR", $($arg)*)}}
macro_rules! log_deb{($($arg:tt)*) => {timber!($crate::level::DEB, "DEB", $($arg)*)}}
macro_rules! log_inf{($($arg:tt)*) => {timber!($crate::level::INF, "INF", $($arg)*)}}

//log_err!("This is error! I'm visible!");
//log_deb!("I'm debug. I'm visible only in debug mode.");